/**
 * Copyright &copy; 2012-2016 <a href="https://istep.lczyfz.com">Istep</a> All rights reserved.
 */
package com.lczyfz.istep.modules.resource.service;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;

import com.lczyfz.istep.common.utils.FtpUtil;
import com.lczyfz.istep.common.utils.PropertiesUtil;
import com.lczyfz.istep.modules.resource.entity.ResourceCourse;
import org.apache.commons.net.ftp.FTPClient;
import org.junit.After;
import org.junit.Before;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lczyfz.istep.common.persistence.Page;
import com.lczyfz.istep.common.service.CrudService;
import com.lczyfz.istep.modules.resource.entity.ResourceCourseware;
import com.lczyfz.istep.modules.resource.dao.ResourceCoursewareDao;

/**
 * 课件管理Service
 * @author dh
 * @version 2017-01-16
 */
@Service
@Transactional(readOnly = true)
public class ResourceCoursewareService extends CrudService<ResourceCoursewareDao, ResourceCourseware> {

	public ResourceCourseware get(String id) {
		return super.get(id);
	}
	
	public List<ResourceCourseware> findList(ResourceCourseware resourceCourseware) {
		return super.findList(resourceCourseware);
	}
	
	public Page<ResourceCourseware> findPage(Page<ResourceCourseware> page, ResourceCourseware resourceCourseware) {
		return super.findPage(page, resourceCourseware);
	}
	
	@Transactional(readOnly = false)
	public void save(ResourceCourseware resourceCourseware) {
		super.save(resourceCourseware);
	}
	
	@Transactional(readOnly = false)
	public void delete(ResourceCourseware resourceCourseware) {
		super.delete(resourceCourseware);
	}

	/**
	 * 根据课程id查询课件列表
	 * @param page
	 * @param resourceCourseware
	 * @return
	 */
	public Page<ResourceCourseware> findPageByCourseId(Page<ResourceCourseware> page, ResourceCourseware resourceCourseware) {
		resourceCourseware.setPage(page);
		page.setList(dao.findListByCourseId(resourceCourseware));
		return page;
	}

	//查看课程学习情况
	public Page<ResourceCourseware> viewCourseLearnList(Page<ResourceCourseware> page, ResourceCourseware resourceCourseware) {
		logger.debug("==Evan==viewCourseLearnListService=="+resourceCourseware.getCourseId());
		resourceCourseware.setPage(page);
		page.setList(dao.viewCourseLearnList(resourceCourseware));
		return page;
	}

	//进入课程学习-根据课程id查询课件列表
	public List<ResourceCourseware> findListByCourseId(String courseId) {
		ResourceCourseware resourceCourseware = new ResourceCourseware();
		resourceCourseware.setCourseId(courseId);
		return dao.findListByCourseId(resourceCourseware);
	}

}